import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class test {

	private final Logger log = Logger.getLogger(test.class);

	public static List getMessages(int messageId) {
		SessionFactory sessions = new AnnotationConfiguration().configure()
				.buildSessionFactory();
		Session session = sessions.openSession();
		try {
			session.beginTransaction();
			// List list = session.createQuery("from Message").list();
//			LiveBuilding createLiveBuilding = ModelsFactory.eINSTANCE.createLiveBuilding();
//			session.save(createLiveBuilding);
			session.getTransaction().commit();
			return null;

		} catch (HibernateException e) {
			if (session.getTransaction() != null)
				session.getTransaction().rollback();
		} finally {
			session.close();
		}
		return null;
	}

	public static void main(String[] args) {
		new test().getMessages(1);
	}
}
